
<%@page import="java.util.List"%>
<%@ page pageEncoding="UTF-8" %>
<%@ page import="ch01.FirstlevelTitle" %>
<%@ page import="ch03.FirstLevelTitleDbOpreation" %>
<%@ page import="ch01.SecondLevelTitle" %>
<%@ page import="ch03.SecondLevelTitleDbOpreation" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <title>newspre_simple.jsp</title>
    <style type="text/css">
    	#center {
    		margin: auto;
    		width: 1024px;
    	}
    	
    	#header {
    		float:left;
    		margin:0px;
    	}
    	
    	#left {
    		background-color: #815ee0;
    		float:left;
    		width:250px;
    		height: 600px;
    		
    	}
    	
    	#left img {
    		margin-left: 5px;
    		margin-top:5px;
    		width:200px;
    	}
    	
    	#main {
    		float:left;
    		
    	}
    	
    	#title {
    		background-color: #815ee0;
    		margin-top:5px;
    		margin-left:5px;
    		width:765px;
    		text-align:center;
    		font-size: large;
    	}
    	#login
    	{
    		position: absolute;
    		top:30px;
    		right:200px;
    	}
    	#content
    	{
    		margin-top:30px;
    		margin-left: 50px;
    	}
    </style>
	<script type="text/javascript">
		window.onload = init;
		
		function init() {
			if (self != top) {
				top.location = self.location;
			}
		}
	</script>
  </head>
  
  <body>
    <div id="center">
    	<span id="login">
    		<a id="lg" href="index.jsp" >进入后台</a>
    	</span>
    	<div id="header">
    		<img src="images/head.gif" alt="" />
    		
    	</div>
    	<div id="left">
    		<img src="images/left.jpg" alt="" /><br/>
    		<h3 align="center">新闻分类</h3>
    		<%
				List list1 = FirstLevelTitleDbOpreation.getAllFirstLevelTitleList();
				if (list1 != null && list1.size() != 0) {
					for (int i = 0; i < list1.size(); i++) {
						FirstlevelTitle fTitle = (FirstlevelTitle)list1.get(i);
						%>
						<div align="center">
						<a href="newspre_simple.jsp?parentId=<%=fTitle.getId() %>"><%=fTitle.getTitleName() %></a>
						</div>
						<br />
						<%
					}
				}

			 %>
			 <%-- 
			 <div style="float: right;">
			 	<a href="showAllLoginedUser.jsp" target="mainFrame">已访问人数统计</a>
			 </div>
			 --%>
    	</div>
    	<div id="main">
    		<div id="title">
    			welcome to the new station!
    		</div>
    		<div id="content">
    			<!--显示二级标题  -->
    			<%
    				String strParentId = request.getParameter("parentId");
    				if (strParentId != null) {
    					int patentId = Integer.parseInt(strParentId);
    					List list2 = SecondLevelTitleDbOpreation.getSecondByFirst(patentId);
    					%>
    					<tr>
    						<td valign="top" height="531" bgcolor="#000000">
    							<br>
    							<%
    								if (list2 != null && list2.size() != 0) {
    									for (int i = 0; i < list2.size(); i++) {
    										SecondLevelTitle sTitle = (SecondLevelTitle)list2.get(i);
    										%>
    										<li>
    											<a href="<%=sTitle.getFilePath() %>"><%=sTitle.getTitleName() %></a>
    										</li>
    										<br>
    										<br>
    										<%
    									}
    								}
    							 %>
    						</td>
    					</tr>
    					<%
    				}
    			 %>
    		</div>
    	</div>
    </div>
  </body>
</html>
